package com.sky.controller.user;


import cn.hutool.core.bean.BeanUtil;
import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.ICategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Slf4j
@RequiredArgsConstructor
@Api(tags = "用户端-菜品分类接口")
public class CategoryController {
    private final ICategoryService categoryService;
    @ApiOperation("根据类型查询分类")
    @GetMapping("list")
    public Result<List<Category>> list(Integer type) {

        List<Category> list = categoryService.lambdaQuery().eq(type!=null,Category::getType, type).list();
        return Result.success(list);
    }
}
